clear all
set more off


****************************************************
* TABLE 9 - OUTCOME TEST - SURVIVAL AFTER 3Y & 5Y
****************************************************
use "${file}sine_panel.dta", clear
bys SIREN YEAR: keep if Y==YEAR // use the cross-sectional dataset

// define sample
reghdfe FINV4 FEMALE NAF4_crea_d5 nf4crea AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM B2B GEOCLIA MOYENS_*  ///
MOTIV1 MOTIV2 MOTIV4 MOTIV3 MOTIV5 MOTIV6 ///
, cluster(ape4) absorb(apey4 dep)
gen sample=e(sample)

eststo clear

* VC-backed in male-dominated sectors (Panel A - Columns 1 & 2)
reghdfe SURV3 FEMALE VC VCF AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if NAF4_crea_d5==0, cluster(ape4) absorb(apey4 dep)
estimates store p_1
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

reghdfe SURV5 FEMALE VC VCF AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if NAF4_crea_d5==0, cluster(ape4) absorb(apey4 dep)
estimates store p_2
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

* VC-backed in female-dominated sectors (Panel B - Columns 1 & 2)
reghdfe SURV3 FEMALE VC VCF AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if NAF4_crea_d5==1, cluster(ape4) absorb(apey4 dep)
estimates store p_1_f
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

reghdfe SURV5 FEMALE VC VCF AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if NAF4_crea_d5==1, cluster(ape4) absorb(apey4 dep)
estimates store p_2_f
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

* Bank-financed in male-dominated sectors (Panel A - Columns 5 & 6)
reghdfe SURV3 FEMALE FINV1 FFINV1 AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if NAF4_crea_d5==0, cluster(ape4) absorb(apey4 dep)
estimates store p_1_b
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

reghdfe SURV5 FEMALE FINV1 FFINV1 AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if NAF4_crea_d5==0, cluster(ape4) absorb(apey4 dep)
estimates store p_2_b
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

* Bank-financed in male-dominated sectors (Panel B - Columns 5 & 6)
reghdfe SURV3 FEMALE FINV1 FFINV1 AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if NAF4_crea_d5==1, cluster(ape4) absorb(apey4 dep)
estimates store p_1_f_b
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

reghdfe SURV5 FEMALE FINV1 FFINV1 AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if NAF4_crea_d5==1, cluster(ape4) absorb(apey4 dep)
estimates store p_2_f_b
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

****************************************************
* TABLE 9 - OUTCOME TEST - DELTA SALES 3Y & 5Y
****************************************************
use "${file}ficusfare_all.dta", clear 

* prepare performance dataset
tab Y YEAR // check panel dimention
keep if YEAR!=. // drop observables from ficus fare that do not match with SINE
keep if Y>=YEAR // make sure observations happen after the firm's creation year


* merge entrepreneur and startup characteristics
merge m:1 SIREN YEAR using "${file}sine_panel.dta" 
keep if _merge==3
drop _m

gen YN=Y-YEAR+1 // define years from creation: 1, 2, 3 --> delta sales from creation year (YN==1)

drop siren_num
sort YEAR SIREN Y
egen siren_num=group(SIREN)
xtset siren_num Y // define panel dimention: siren-year

* winsorize delta sales
summ dsales3 if YN==1, d 
summ dsales5 if YN==1, d 
winsor2 dsales3 dsales5, replace cut(1 99)

* VC-backed in male-dominated sectors (Panel A - Columns 3 & 4)
reghdfe dsales3 FEMALE VC VCF ///
AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if YN==1& NAF4_crea_d5==0, cluster(ape4) absorb(apey4 dep)
estimates store p_3
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

reghdfe dsales5 FEMALE VC VCF ///
AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if YN==1& NAF4_crea_d5==0, cluster(ape4) absorb(apey4 dep)
estimates store p_4
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

* VC-backed in female-dominated sectors (Panel B - Columns 3 & 4)
reghdfe dsales3 FEMALE VC VCF ///
AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if YN==1& NAF4_crea_d5==1, cluster(ape4) absorb(apey4 dep)
estimates store p_3_f
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

reghdfe dsales5 FEMALE VC VCF ///
AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if YN==1& NAF4_crea_d5==1, cluster(ape4) absorb(apey4 dep)
estimates store p_4_f
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

* Bank-financed in male-dominated sectors (Panel A - Columns 7 & 8)
reghdfe dsales3 FEMALE FINV1 FFINV1 ///
AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if YN==1& NAF4_crea_d5==0, cluster(ape4) absorb(apey4 dep)
estimates store p_3_b
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

reghdfe dsales5 FEMALE FINV1 FFINV1  ///
AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if YN==1& NAF4_crea_d5==0, cluster(ape4) absorb(apey4 dep)
estimates store p_4_b
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

* Bank-financed in female-dominated sectors (Panel B - Columns 7 & 8)
reghdfe dsales3 FEMALE FINV1 FFINV1  ///
AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if YN==1& NAF4_crea_d5==1, cluster(ape4) absorb(apey4 dep)
estimates store p_3_f_b
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean

reghdfe dsales5 FEMALE FINV1 FFINV1  ///
AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM ///
 B2B GEOCLIA MOYENS_* ///
if YN==1& NAF4_crea_d5==1, cluster(ape4) absorb(apey4 dep)
estimates store p_4_f_b
estadd local year "Yes"
estadd local geo "Yes"
estadd local cap "Yes"
estadd ysumm, mean


* Export Panel A
esttab p_1 p_2 p_3 p_4 p_1_b p_2_b p_3_b p_4_b  /*
*/ using "${output}table_outcometest_msec.tex" /*
*/ ,replace booktabs label lines compress nocons collabels(none) nodepvars nomtitles nonumber fragment /*
*/ cells("b(star fmt(%9.4f))" "se(par fmt(%9.2f))") star(* 0.10 ** 0.05 *** 0.01) /*
*/ stats(cap year geo r2 N ymean, fmt(0 0 0 %9.3fc %9.0fc %9.4fc) /*
*/ labels(`"Startup \& Founders characteristics"' `"Sector FE $\times$ Cohort-year FE"' `"County FE"' `"R^{2}"' `"N"' `"Mean dep. var."')) /*
*/ order(FEMALE VC VCF FINV1 FFINV1) /*
*/ keep(FEMALE VC VCF FINV1 FFINV1) 

* Export Panel B
esttab p_1_f p_2_f p_3_f p_4_f p_1_f_b p_2_f_b p_3_f_b p_4_f_b /*
*/ using "${output}table_outcometest_fsec.tex" /*
*/ ,replace booktabs label lines compress nocons collabels(none) nodepvars nomtitles nonumber fragment /*
*/ cells("b(star fmt(%9.4f))" "se(par fmt(%9.2f))") star(* 0.10 ** 0.05 *** 0.01) /*
*/ stats(cap year geo r2 N ymean, fmt(0 0 0 %9.3fc %9.0fc %9.4fc) /*
*/ labels(`"Startup \& Founders characteristics"' `"Sector FE $\times$ Cohort-year FE"' `"County FE"' `"R^{2}"' `"N"' `"Mean dep. var."')) /*
*/ order(FEMALE VC VCF FINV1 FFINV1) /*
*/ keep(FEMALE VC VCF FINV1 FFINV1) 



************************************************************
* TABLE 1 - DESCRIPTIVE STATISTICS PERFORMANCE
************************************************************
use "${file}ficusfare_all.dta", clear

* prepare performance dataset
tab Y YEAR // check panel dimention
keep if YEAR!=. // drop observables from ficus fare that do not match with SINE
keep if Y>=YEAR // make sure observations happen after the firm's creation year


* merge entrepreneur and startup characteristics
merge m:1 SIREN YEAR using "${file}sine_panel.dta" 
keep if _merge==3
drop _m

gen YN=Y-YEAR+1 // define years from creation: 1, 2, 3 --> delta sales from creation year (YN==1)

drop siren_num
sort YEAR SIREN Y
egen siren_num=group(SIREN)
xtset siren_num Y // define panel dimention: siren-year

* define sample
reghdfe FINV4 FEMALE NAF4_crea_d5 nf4crea AGED NATIOA1 EDUC2 EDUC3 GRANDEECO EXPERT SERIAL DIRIGA INC OBJECTIF INOV_SUM B2B GEOCLIA MOYENS_*  ///
MOTIV1 MOTIV2 MOTIV4 MOTIV3 MOTIV5 MOTIV6 ///
, cluster(ape4) absorb(apey4 dep)
gen sample=e(sample)

* winsorize
summ dsales3 if YN==1, d 
summ dsales5 if YN==1, d 
winsor2 dsales3 dsales5, replace cut(1 99)
winsor2 deff3 deff5, replace cut(1 99)

label var dsales3 "$\Delta$ sales$_{t=0,3}$"
label var dsales5 "$\Delta$ sales$_{t=0,5}$"
label var deff3 "$\Delta$ employees$_{t=0,3}$"
label var deff5 "$\Delta$ employees$_{t=0,5}$"

** Stat desc
eststo clear
set more off

eststo all: estpost summ ///
dsales3 dsales5 deff3 deff5 ///
if  YN==1&sample

eststo male: quietly estpost summ ///
dsales3 dsales5 deff3 deff5 ///
if  YN==1&FEMALE==0 &sample

eststo fem: quietly estpost summ ///
dsales3 dsales5 deff3 deff5 ///
if  YN==1&FEMALE==1 &sample

eststo diff: quietly estpost ttest ///
dsales3 dsales5 deff3 deff5 ///
if  YN==1&sample, by(FEMALE) unequal

set more off
esttab all male fem diff , ///
cells("count(pattern(0 1 1 0) fmt(0)) mean(pattern(1 1 1 0) fmt(4)) b(star pattern(0 0 0 1) fmt(2)) t(pattern(0 0 0 1) par fmt(2))") ///
label star(* 0.1 ** 0.05 *** 0.01)  collabels(none) booktabs
